<h1 align = 'center'>REPAIR FACILITY</h1>
<form action = "<?=$base_url ?>pfmis/problem/repair" METHOD = "POST">
<?php
    $this->load->database();
    $selectRepairQ = 'SELECT pf_facilities.FacilityID, FacilityName, RoomAssigned, CasualtyDesc FROM pf_facilities, pf_casualty WHERE pf_facilities.FacilityID = pf_casualty.FacilityID AND pf_casualty.Status = 0 AND pf_facilities.Status != -1';
    $selectRepairR = $this->db->query($selectRepairQ);
    if($selectRepairR->num_rows() > 0)
    {
        echo '<table align = "center"><tr><td>Select Facility:</td><td><select name = "facility">';
        foreach($selectRepairR->result() as $selectRepair)
        {
            echo '<option value = '.$selectRepair->FacilityID.'>'.$selectRepair->FacilityName.' in '.$selectRepair->RoomAssigned.' - '.$selectRepair->CasualtyDesc.'</option>';
        }
        echo '</select></td></tr><tr><td>How much?</td><td><input type = "text" name = "price"></td></tr><tr><td colspan = 2 align = "center"><input type = "submit"></td></tr></table>';
    }
    else
    {
        echo '<h5 align = "center"><i>no facilities to be repaired</i></h5>';
    }
?>
</form>